#include<iostream>
struct TreeNode {
    int val;
    struct TreeNode* left;
    struct TreeNode* right;
};
void sums(struct TreeNode* root, int* num)
{
    if (!root)
        return;
    if (root->left && !root->left->left && !root->left->right)
    {
        *num += root->left->val;
    }
    sums(root->left, num);
    sums(root->right, num);
    return;
}

int sumOfLeftLeaves(struct TreeNode* root) {
    int num = 0;
    sums(root, &num);
    return num;
}